import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 学年及班级信息信息 */
export interface AcademicYear {
          yearId: number; // 学年唯一ID
          schoolYear?: string; // 学年，如2024-2025
          term?: string; // 学期，如第二学期
          className?: string; // 班级名称，如25春体检班
          classroomName?: string; // 教室名称，如B215
          headteacher: string; // 班主任姓名
  }

// 学年及班级信息 API
export const AcademicYearApi = {
  // 查询学年及班级信息分页
  getAcademicYearPage: async (params: any) => {
    return await request.get({ url: `/ao/academic-year/page`, params })
  },

  // 查询学年及班级信息详情
  getAcademicYear: async (id: number) => {
    return await request.get({ url: `/ao/academic-year/get?id=` + id })
  },

  // 新增学年及班级信息
  createAcademicYear: async (data: AcademicYear) => {
    return await request.post({ url: `/ao/academic-year/create`, data })
  },

  // 修改学年及班级信息
  updateAcademicYear: async (data: AcademicYear) => {
    return await request.put({ url: `/ao/academic-year/update`, data })
  },

  // 删除学年及班级信息
  deleteAcademicYear: async (id: number) => {
    return await request.delete({ url: `/ao/academic-year/delete?id=` + id })
  },

  /** 批量删除学年及班级信息 */
  deleteAcademicYearList: async (ids: number[]) => {
    return await request.delete({ url: `/ao/academic-year/delete-list?ids=${ids.join(',')}` })
  },

  // 导出学年及班级信息 Excel
  exportAcademicYear: async (params) => {
    return await request.download({ url: `/ao/academic-year/export-excel`, params })
  },
}